package com.xqboss.apps.dto.user;

import com.xqboss.apps.dto.PageDto;
import com.xqboss.apps.enums.user.WithdrawStatusEnum;
import com.xqboss.apps.enums.user.PayTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;

/**
 * 获取提现列表的过滤参数
 * @author Trent
 * @date 2023/8/17
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel
public class GetWithdrawListDto extends PageDto {

    @ApiModelProperty("用户ID")
    private Long userId;

    @ApiModelProperty("提现状态")
    private WithdrawStatusEnum status;

    @ApiModelProperty("提现方式")
    private PayTypeEnum withdrawWay;

    @ApiModelProperty("开始时间")
    private LocalDateTime createTimeStart;

    @ApiModelProperty("结束时间")
    private LocalDateTime createTimeEnd;

    @ApiModelProperty("搜索")
    private String searchValue;

    public LocalDateTime getCreateTimeEnd() {
        if(Objects.nonNull(createTimeEnd)){
            return createTimeEnd.with(LocalTime.MAX);
        }
        return createTimeEnd;
    }

}
